home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / script / autoget < prev    next >
Encoding:
Text File  |  2002-10-28  |  828 b   |  41 lines

  1. #
  2. # Autoget!  Because people keep asking me for this.
  3. # Ok.  Here's the plan.
  4. # /autoget <pattern> [<pattern> ....] will auto-get any file that matches
  5. #    any of the patterns.
  6. # /autoget -<pattern>  will stop autogetting any file that matches this
  7. #    pattern.
  8. # You can mix and match <pattern>s and -<pattern>s.
  9. #
  10. package autoget
  11. @ autoget_patterns = [ ]
  12.  
  13. on #-dcc_request 414 "% SEND *" {
  14.     if (rmatch($2 $autoget_patterns)) {
  15.         dcc get $0 $2
  16.     }
  17. }
  18.  
  19. alias autoget {
  20.     if (strlen($*) == 0) {
  21.         xecho -b Autogetting files matching [$autoget_patterns]
  22.         return
  23.     }
  24.     fe ($*) x {
  25.         if (left(1 $x) == [-]) {
  26.             @ x = rest(1 $x)
  27.             @ autoget_patterns = remw($x $autoget_patterns)
  28.         } {
  29.             push autoget_patterns $x
  30.         }
  31.     }
  32. }
  33.  
  34. on ^unload "autoget" {
  35.     ^assign -autoget_patterns
  36.     ^alias -autoget
  37.     ^on #dcc_request 414 -"% SEND *"
  38. }
  39.  
  40. #hop'y2k+1
  41.